package cn.edu.dlut.ssdut.foodCredit2012.service;

import org.hibernate.Session;

import cn.edu.dlut.ssdut.foodCredit2012.model.UploadFile;
import cn.edu.dlut.ssdut.foodCredit2012.util.HibernateUtil;

public class UploadService {
	public void add(UploadFile file) {
		Session session = HibernateUtil.getFileSessionFactory().getCurrentSession();
		session.beginTransaction();
		session.save(file);
		session.getTransaction().commit();
	}
	
	public void delete(UploadFile file) {
		Session session = HibernateUtil.getFileSessionFactory().getCurrentSession();
		session.beginTransaction();
		session.delete(file);
		session.getTransaction().commit();
	}
	
	public void upload(UploadFile file) {
		Session session = HibernateUtil.getFileSessionFactory().getCurrentSession();
		session.beginTransaction();
		session.delete(file);
		session.getTransaction().commit();
	}
	
}
